<?php
class BaseAction
{
	protected $configer;
	protected $template;
	
	protected $get = array();
	protected $post = array();
	protected $request = array();
	
	private $assignData = array();
	
	public function __construct($pageContext)
	{
		$this->configer = ConfigerFactory::create();
		$this->template = TemplateFactory::create();
		
		$this->get = $_GET;
		$this->post = $_POST;
		$this->request = $_REQUEST;
	}
	
	protected  function assign($key, $value)
	{
		$this->assignData[$key] = $value;
	}
	
	protected function display($path, $return = false)
	{
		$path = PROJECT_PUBLIC_PATH . $path; 
		
		if($return)
		{
			return $this->template->display($path, $this->assignData, true);
		}
		else
		{
			$this->template->display($path, $this->assignData, false);
		}
	}
	
	protected function throwException($message, $code = null)
	{
		throw new Exception($message, $code);
	}
}
?>